// 引入Service和请求头ServiceName
import { Service, ServiceName } from '@/network/http.js'
import store from '@/store/index.js' // 引入store

const api = {
  // 查询作业指令
  getTrustOrderData (params) {
    return Service.get(
      `/${ServiceName}/api/external/tBusTrust/queryall`,{params}
    )
  },
  // 作业指令导入工班计划
  importTrust (params) {
    store.commit('changeStatus', true)
    return Service.post(
      `/${ServiceName}/api/external/workPlan/addInoutPlan`,params
    )
  },
  // 查询工班计划
  getWorkPlanData (params) {
    return Service.get(
      `/${ServiceName}/api/external/workPlan/queryall`,{params}
    )
  },
  // 查询作业工段
  getworksection (params) {
    return Service.get(
      `/${ServiceName}/api/external/workPlan/queryactivitysections`
    )
  },
  // 查询协力队
  queryoperativeteam (params) {
    return Service.get(
      `/${ServiceName}/api/external/workPlan/queryoperativeteam`
    )
  },
  // 查询劳务
  querylabor (params) {
    return Service.get(
      `/${ServiceName}/api/external/workPlan/querylabor`
    )
  },
  // 查询  （前沿，转运，后场，辅助）的机械类型
  querymachine (params) {
    return Service.get(
      `/${ServiceName}/api/external/workPlan/querymachine`
    )
  },
  // 查询机械类型为门机的编号
  queryMachineTypeOne (params) {
    return Service.get(
      `/${ServiceName}/api/external/workPlan/queryMachineTypeOne`
    )
  },
  // 查询指导员
  queryWorkPeople (params) {
    return Service.get(
      `/${ServiceName}/api/external/workPlan/queryWorkPeople`
    )
  },
  // 根据id删除作业计划
  deletebyid (params) {
    return Service.delete(
      `/${ServiceName}/api/external/workPlan/deletebyid?id=${params}`
    )
  },
  // 根据id更新作业计划
  updatebyid (params) {
    store.commit('changeStatus', true)
    return Service.put(
      `/${ServiceName}/api/external/workPlan/updatebyid`,params
    )
  },
  // 根据id审核作业计划
  updateStatus (params) {
    store.commit('changeStatus', true)
    return Service.put(
      `/${ServiceName}/api/external/workPlan/updateStatus?id=${params}`
    )
  },
  // 根据id赋值计划
  copyById (params) {
    return Service.get(
      `/${ServiceName}/api/external/workPlan/copyById?id=${params}`
    )
  },
  // 查询上班次
  queryByStatus (params) {
    return Service.get(
      `/${ServiceName}/api/external/workPlan/queryByStatus`,{params}
    )
  },
  // 导入上班次
  copylastwork (params) {
    store.commit('changeStatus', true)
    return Service.post(
      `/${ServiceName}/api/external/workPlan/copy`,params
    )
  },
  // 查询零工主列表
  queryApplication (params) {
    return Service.get(
      `/${ServiceName}/api/external/workPlan/queryApplication`, { params }
    )
  },
  // 零工计划修改
  updateApplicationPlan (params) {
    return Service.put(
      `/${ServiceName}/api/external/workPlan/updateApplicationPlan`, params
    )
  },
  /**
   * 集疏港申请查询主列表
   */
  queryPort (params) {
    return Service.get(
      `/${ServiceName}/api/external/workPlan/queryPort`, { params }
    )
  },
  /**
   * 集疏港申请保存
   */
  updatePort (params) {
    store.commit('changeStatus', true)
    return Service.put(
      `/${ServiceName}/api/external/workPlan/updatePort`, params
    )
  },
  // 查询转运计划
  queryTransportPlan (params) {
    return Service.get(
      `/${ServiceName}/api/external/workPlan/queryTransportPlan`,{params}
    )
  },
  /**
   * 集疏港申请保存
   */
   updateTransportPlan (params) {
    store.commit('changeStatus', true)
    return Service.put(
      `/${ServiceName}/api/external/workPlan/updateTransportPlan`, params
    )
  },
}
export default api